package com.gupaoedu.pattern.strategy;

import java.util.HashMap;
import java.util.Map;

/**
 * 2019/9/28
 * created by chenpp
 */
public class StrategyContext {

    private static Map<String,Strategy> strategyMap = new HashMap<String,Strategy>();
    public static final String NOT_ARRIVAL_AT_TIME = "not arrival at time";
    public static final String FLIGHT_CALCEL = "flight cancel";
    public static final String ITINERARY_CALCEL = "itinerary cancel";

    static {
        strategyMap.put(NOT_ARRIVAL_AT_TIME,new ForgetFlightStrategy());
        strategyMap.put(FLIGHT_CALCEL,new FlightCancelStrategy());
        strategyMap.put(ITINERARY_CALCEL,new ItineraryCancelStrategy());
    }

    public static Strategy getStrategy(String reason){
        return strategyMap.get(reason);
    }
}
